<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 计算器
    if判断第几天 -->

    <input type="text" id="first">
    <select id="op" >
        <option value="+">+</option>
        <option value="-">-</option>
        <option value="*">*</option>
        <option value="/">/</option>
    </select>
    <input type="text" id="second">
    <button id="btn">=</button>
    <input type="text" id="result" disabled/>

    <script>
        // btn.onclick=function(){
          
        //     switch(op.value){
        //         case '+':
        //             result.value=(first.value-0) + (second.value-0)
        //             break
        //         case '-':
        //             result.value= first.value - second.value
        //             break
        //         case '*':
        //             result.value= first.value * second.value
        //             break
        //         case '/':
        //             result.value= first.value / second.value
        //             break
        //     }
        // }

        btn.onclick = function (){
            var n1 = first.value -0;
            var n2 = second.value -0;
            var type = op.value

            var res =0;
            console.log(type);

            switch(type){
                case "+":
                    res = n1 + n2;
                case "-":
                    res = n1 - n2;
                case "*":
                    res = n1 * n2;
            }
         }



    </script>


   <script>

         function dayif(year,month,day){

            var today=day;

            for(var i=1;i<=month;i++){

                if(i==2||i==4||i==6||i==8||i==9||i==11){
                    today+=31;
                }else if(i==5||i==7||i==10||i==12){
                    today+=30;
                }else if(i==3){
                    if((year %4 ===0 && year%100!==0) ||year%400===0){
                        today+=29;
                    }else{
                        today+=28;
                    }
                }
            }
            document.write(`<br>${year}年${month}月${day}日是这一年的${today}天`);
         }

         dayif(2022,3,9);
         dayif(2022,4,2);
         dayif(2022,11,9);
         dayif(2022,12,30);


         var year = 2022;
         var month = 12;
         var date = 31;

         var result = 0
         switch(month){
            case 12:
                result +=30;
            case 11:
                result +=31;
            //...
            case 3:
            if( (year %4 ===0 && year %100 !==0)||year%400 ===0){
                result +=29;
            }else{
                result +=28;
            }

         }
         result += date;
         console.log(result);

 

   </script>





   



</body>
</html>